<?php
include_once( dirname( __FILE__ )."/inc/conn.php" );
include_once( dirname( __FILE__ )."/inc/function.php" );
login_check( "system" );
echo "<!DOCTYPE HTML>\r\n<HTML>\r\n<HEAD>\r\n<TITLE>合作商家--后台管理系统</TITLE>\r\n<META http-equiv=Content-Type content=\"text/html; charset=utf-8\">\r\n<LINK href=\"images/css_body.css\" type=text/css rel=stylesheet>\r\n<META content=\"MSHTML 6.00.3790.4275\" name=GENERATOR>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\"/>\r\n<script type=\"text/javascript\" charset=\"utf-8\" src=\"ueditor/ueditor.config.js\"></script>\r\n
    <script type=\"text/javascript\" charset=\"utf-8\" src=\"ueditor/ueditor.all.min.js\"> </script>\r\n<script type=\"text/javascript\" charset=\"utf-8\" src=\"ueditor/lang/zh-cn/zh-cn.js\"></script>

    <style type=\"text/css\">
        
    </style></HEAD>\r\n<BODY>\r\n";

function edit(){
	global $db;
	global $web_dbtop;
	$content = empty($_POST['editorValue'])? '' : $_POST['editorValue'];
	$now = time();

	$query = $db->query(" update yj_longtext set yj_value='$content',last_update='$now' where yj_key = 'cooperation'");
	if ($query) {
		echo "<script type=\"text/javascript\">alert('操作完成!!');</script>";
	}else{
		echo "<script type=\"text/javascript\">alert('操作失败!!,请重试');</script>";
	}
	main();
}

function main()
{
	global $db;
	global $web_dbtop;
	$query = $db->query(" select * from yj_longtext where yj_key = 'cooperation'");
	$res = $db->fetch_array($query);

	echo "<div><form action='admin_cooperation_set.php?action=edit' method='post'><script id=\"editor\" type=\"text/plain\" style=\"width:1024px;height:500px;\"></script><div style='width:1120px;height:auto;text-align:center;'><input type='submit' class='input' value='修改' name='submit'></div><script type=\"text/javascript\">
	var ue = UE.getEditor('editor');  ue.addListener( 'ready', function( editor ) {
     UE.getEditor('editor').setContent('".$res['yj_value']."', false);
 } );
    </script></form></div>";
}

switch ( $_GET['action'] )
{
case "edit" :
		edit();
		break;
default :
	main();
}

echo "</BODY></HTML>\r\n";
?>

